package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppTeamTaskMapper;
import com.ep.modules.app.entity.AppTeamTask;
import com.ep.modules.app.entity.AppTeamTaskExample;
import com.ep.modules.app.service.AppTeamTaskService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppTeamTaskServiceImpl implements AppTeamTaskService {
    @Autowired
    private AppTeamTaskMapper appTeamTaskMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppTeamTaskExample example = new AppTeamTaskExample();
        AppTeamTaskExample.Criteria criteria = example.createCriteria();
        List<AppTeamTask> list = appTeamTaskMapper.selectByExample(example);
        Page<AppTeamTask> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppTeamTask getById(Long id) {
        return appTeamTaskMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppTeamTask entity) {
        appTeamTaskMapper.insert(entity);
    }

    public void update(AppTeamTask entity) {
        appTeamTaskMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appTeamTaskMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}